VSCode + WSL win10环境下搭建C开发环境 |
您所在的位置:网站首页 › ubuntu1804 vscode配置c++环境 › VSCode + WSL win10环境下搭建C开发环境 |
一. 开启window的WSL(Windows Subsystem for Linux)
控制面板- 启用或关闭Windows功能, 需要重启系统
下载之后是.appx, 改成.zip然后解压文件
密码就是前面设置的密码 三. 对接VSCode安装VSCode插件
创建代码目录 mkdir hub 同步目录 code hub如果没有code命令, 通过
VSCode(Ctrl+Shift+P),输入"Remote-WSL: New Window using Distro"
代码目录建立.VSCode文件夹,加入launch.json和tasks.json文件 // launch.json { "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}.out", "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "/usr/bin/gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "complie" } ] } //tasks.json { "version": "2.0.0", "tasks": [ { "label": "complie", "type": "shell", "command": "g++", "args": [ "--std=c++11", "-g", "${fileDirname}/${fileBasename}", "-o2", "-o", "${fileDirname}/${fileBasenameNoExtension}.out" ], "presentation": { "reveal": "silent" }, "problemMatcher": "$gcc" } ] } 运行测试 Ctrl + Alt + N优雅地使用VSCode与WSL在Windows 10下开发 手动安装WSL发行版 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |